package org.example.route.mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.route.model.dto.StationDTO;
import org.example.route.model.dto.StationQueryDTO;
import org.example.route.model.pojo.Station;

import java.util.List;

@Mapper
public interface StationMapper {


    @Insert("insert into station (name, city_id) VALUES (#{name},#{cityId})")
    void add(StationDTO stationDTO);

    List<Station> list(StationQueryDTO stationQueryDTO);

    @Select("select name from station where id = #{stationId}")
    String getNameById(Long stationId);



    List<Station> getByCityId(Long cityId);

    @Select("select * from station where id = #{stationId}")
    Station getById(Long id);

    @Select("delete from station where id = #{id}")
    void deleteById(Long id);
}
